﻿using System;
using System.Collections.Generic;
using Duality;

namespace ClientApp
{
	public sealed class AiManager
	{
		private static AiManager instance;

		public static AiManager Instance
		{
			get
			{
				if (instance == null) instance = new AiManager();
				return instance;
			}
		}
		
		private HashSet<Agent> agents = new HashSet<Agent>();

		public IEnumerable<Agent> Agents
		{
			get { return agents; }
		}

		private AiManager() {}
		public void PrepareAgentUpdates()
		{
			foreach (Agent agent in agents) agent.Hrvo.update();
		}
		public void RegisterAgent(Agent agent)
		{
			agents.Add(agent);
		}
		public void RemoveAgent(Agent agent)
		{
			agents.Remove(agent);
		}
	}
}
